<%--
  Created by IntelliJ IDEA.
  User: 016
  Date: 2022/6/4
  Time: 14:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">仓库</label>
        <div class="layui-input-block">
            <input type="radio" name="stock_name" value="一号仓库" title="一号仓库" checked="">
            <input type="radio" name="stock_name" value="二号仓库" title="二号仓库">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">负责人</label>
        <div class="layui-input-block">
            <input type="text" name="person" lay-verify="required" lay-reqtext="负责人不能为空" placeholder="请输入负责人姓名" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">来源</label>
        <div class="layui-input-block">
            <input type="text" name="origin" lay-verify="required" lay-reqtext="货物来源不能为空" placeholder="请输入货品来源" value="" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认创建</button>
        </div>
    </div>
</div>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var index = layer.alert("仓库名："+data.field.stock_name+"<br>"+
                "负责人："+data.field.person+"<br>"
                +"来源："+data.field.origin, {
                title: '最终的提交信息'
            }, function () {

                $.post('/orderin_addOrder',data.field,function(result) {
                    // console.log('前端输出的'+result1)
                    if(result.result){
                        layer.msg('增加成功');

                        var index = layer.open({
                            title: '添加入库订单明细',
                            type: 2,
                            shade: 0.2,
                            maxmin:true,
                            shadeClose: true,
                            area: ['100%', '100%'],
                            content: '../table/orderdetadd.jsp'
                        });
                        $(window).on("resize", function () {
                            layer.full(index);
                        });
                        // var iframeIndex = parent.layer.getFrameIndex(window.name);
                        // parent.layer.close(iframeIndex);
                    }
                    else {
                        layer.msg('增加失败');
                    }
                });

            });

            return false;
        });

    });
</script>
</body>
</html>